<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="stylesheet" href="./css/sign.css">
</head>

<body>
    <div class="sign">
        <nav class="bd title">
            <a href="javascript:;">
                <img src="./image/m.png" alt="">
                <div class="title_hd">
                    <h1>小 米 商 城</h1>
                    <span>让每个人都能享受科技的乐趣</span>
                </div>
            </a>
        </nav>
        <div class="sign_hd">
            <div></div>
            <div class="sign_bd">
                <div class="sign_bd_s">
                    <a href="javascript:;">账号登录</a>
                    <span></span>
                    <a href="javascript:;" class="ac">扫码登录</a>
                </div>
                <div class="sign_bd_int">
                    <input type="text" placeholder="邮箱/手机号码/小米ID " id="int">
                    <input type="password" placeholder="密码" id="pass">
                    <a href="javascript:;" id="btn">登录</a>
                </div>
                <div class="sign_bd_new">
                    <p class="p1"> <a href="./login.html">手机短信登录/</a><a href="javascript:;">注册</a> </p>
                    <p class="p2">
                        <a href="./login.html">立即注册</a><span></span>
                        <a href="javascript:;">忘记密码?</a>
                    </p>
                </div>
                <div class="sign_fd">
                    <div class="sign_fd_t">
                        其他方式登录
                    </div>
                    <div class="sign_fd_f">
                        <a href="javascript:;"> <img src="./image/QQ.png" a lt=""> </a>
                        <a href="javascript:;"> <img src="./image/微博.png" a lt=""> </a>
                        <a href="javascript:;"> <img src="./image/支付平台-支付宝.png" a lt=""> </a>
                        <a href="javascript:;"> <img src="./image/微信1.png" a lt=""> </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="footer">
        <div class="footer_hd">
            <a href="javascript:;">简体</a><span></span>
            <a href="javascript:;">繁体</a><span></span>
            <a href="javascript:;">English</a><span></span>
            <a href="javascript:;">常见问题</a>
        </div>
        <p>小米公司版权所有-京ICP备10046444- <a href="javascript:;">京公网安备11010802020134号</a>
            <a href="javascript:;">-京ICP证110507号</a>
        </p>
    </div>
    <script>
        (function() {
            var int = document.getElementById('int')
            var pass = document.getElementById('pass')
            var btn = document.getElementById('btn')
            btn.addEventListener('click', function() {
                fetch('http://dbyxs.xyz:3005/users/login', {
                    method: 'post',
                    headers: {
                        'Content-type': 'application/json;charset=UTF-8'
                    },
                    body: JSON.stringify({
                        user: int.value,
                        password: pass.value
                    })
                }).then(res => {
                    return res.json()
                }).then(res => {
                    window.sessionStorage.setItem('token', res.jwt)
                    window.localStorage.setItem('mi', res.jwt)
                        //  window.sessionStorage.setItem('users', sl)
                    location.href = './index.html'
                })
            })
        })()
    </script>
</body>

</html>